package cn.gene.timeyan.search.webapi.repository;

import cn.gene.timeyan.pojo.search.entity.SeaEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

/**
 * 总内容查询*
 *
 * @author LWG
 * @date 2022/7/25 21:27
 * @since 1.0.0@gene.cn
 */
@Repository
public interface SeaRepository extends
        ElasticsearchRepository<SeaEntity,Long> {
    // 所有更新数据的操作都由Logstash负责,这里无需编写数据更新代码
    @Query("{\n" +
            "    \"bool\": {\n" +
            "      \"should\": [\n" +
            "        { \"match\": { \"article_title\": \"?0\"}},\n" +
            "        { \"match\": { \"article_content\": \"?0\"}},\n" +
            "        { \"match\": { \"help_title\": \"?0\"}},\n" +
            "        { \"match\": { \"help_content\": \"?0\"}}\n" +
            "        ]\n" +
            "     }\n" +
            "}")
    Page<SeaEntity> querySearchs(String keyword, Pageable pageable);
}


